﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess_Layer;
using System.Data;

public partial class MyEbook : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        object currentUser = Session["ThanhVien"];
        if (currentUser != null)
        {
            ((BoundField)MyEbookGRID.Columns[0]).DataField = "STT";
            ((HyperLinkField)MyEbookGRID.Columns[1]).DataTextField = "TenEbook";
            ((HyperLinkField)MyEbookGRID.Columns[1]).DataNavigateUrlFields = new string[] { "DuongDan" };
            ((BoundField)MyEbookGRID.Columns[2]).DataField = "TenTacGia";
            ((HyperLinkField)MyEbookGRID.Columns[3]).Text = "Download";
            ((HyperLinkField)MyEbookGRID.Columns[3]).DataNavigateUrlFields = new string[] { "DuongDan" };

            ((BoundField)MyEbookGRID.Columns[0]).HeaderText = "STT";
            ((HyperLinkField)MyEbookGRID.Columns[1]).HeaderText = "Tên Ebook";
            ((BoundField)MyEbookGRID.Columns[2]).HeaderText = "Tên Tác Giả";

            MyEbookGRID.DataSource = Order_DAC.getEbookOf(Helper.getCurrentUserName((DataTable)currentUser));
            MyEbookGRID.DataBind();
        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }
}